<template>
  <div class="announcementItem" @click="goDetial">
    <img src="../../../assets/tip.png" alt="">

    <span class="title"> <span class="top" v-if="params.top">置顶</span>{{ params.title }}</span>
    <span class="time">{{ params.createdTime | timeFormatemmdd }} </span>
  </div>
</template>

<script>
export default {
  name: "announcementItem",
  methods:{
    goDetial(){
      let {href} = this.$router.resolve({name:'detail',query:{id:this.params.id}})
      window.open(href,'_blank')
    },
  },
  props:{
    params:{
      default:()=>{}
    }
  }
}
</script>

<style scoped lang="less">
.announcementItem{
  display: flex;
  align-items: center;
  img{
    width: 1rem;
    height: 1rem;
  }
  .top{
    display: inline-block;
    width: 4.8rem;
    height: 2.6rem;
    background: #3772FF;
    border-radius: 0.4rem;
    color: white;
    font-size: 1.7rem;
    line-height:2.7rem;
    text-align: center;
    margin:0 1rem;
  }
  .title{
    font-size: 1.8rem;
    color: #333333;
    display: inline-block;
    align-items: center;
    width: 35rem;
    margin-left: 0.5rem;
    overflow:hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    -o-text-overflow:ellipsis;
  }
  .time{
    font-size: 1.7rem;
    color: #999999;
  }
}
</style>